import request from '@/utils/request'

// 查询出资人信息列表
export function listFundInvestor(query) {
    return request({
        url: '/investor/fundInvestor/list',
        method: 'get',
        params: query
    })
}

export function listInfoFundInvestor(query) {
  return request({
    url: '/investor/fundInvestor/listInfo',
    method: 'get',
    params: query
  })
}

// 查询出资人信息列表 不分页
export function listFundInvestorAll(query) {
    return request({
        url: '/investor/fundInvestor/listAll',
        method: 'get',
        params: query
    })
}

export function listDict(query) {
    return request({
        url: '/investor/fundInvestor/listDict',
        method: 'get',
        params: query
    })
}

// 查询出资人信息合计
export function getFundInvestorSum(query) {
  return request({
    url: '/investor/fundInvestor/getSum',
    method: 'get',
    params: query
  })
}

// 查询出资人信息详细
export function getFundInvestor(id) {
    return request({
        url: '/investor/fundInvestor/' + id,
        method: 'get'
    })
}

// 根据出资人ID获取出资人和意向出资人募集基金列表
export function getRaiseFundList(lpId) {
  return request({
    url: '/investor/fundInvestor/getRaiseFundList/' + lpId,
    method: 'get'
  })
}

// 查询出资人信息详细
export function getFundListByCustomerId(customerId) {
    return request({
        url: '/investor/fundInvestor/getFundListByCustomerId/' + customerId,
        method: 'get'
    })
}

// 保存出资人信息
export function saveFundInvestor(data) {
    return request({
        url: '/investor/fundInvestor/save',
        method: 'post',
        data: data
    })
}

// 删除出资人信息
export function delFundInvestor(id) {
    return request({
        url: '/investor/fundInvestor/' + id,
        method: 'delete'
    })
}

// 导出出资人信息
export function exportFundInvestor(query) {
    return request({
        url: '/investor/fundInvestor/export',
        method: 'get',
        params: query
    })
}

// 根据类型获取对应的name
export function changeNameByType(type) {
    return request({
        url: '/investor/fundInvestor/changeNameByType/' + type,
        method: 'get'
    })
}

export function updateSubscription(data) {
  return request({
    url: '/investor/fundInvestor/updateSubscription',
    method: 'post',
    data: data
  })
}

// 根据类型与名称模糊查询对应的name
export function changeNameByTypeAndName(type, name) {
  return request({
    url: '/investor/fundInvestor/changeNameByTypeAndName',
    method: 'get',
    params: {
      type,
      name
    }
  })
}

// 根据类型获取对应的name
export function changeNameByTypeValue(type) {
    return request({
        url: '/investor/fundInvestor/changeNameByTypeValue/' + type,
        method: 'get'
    })
}

// 根据类型获取对应的name
export function checkInvestor(type, investName) {
    return request({
        url: '/investor/fundInvestor/check/investor/' + type + '/' + investName,
        method: 'get'
    })
}

// 根据当前认缴金额计算认缴比例
export function calculationAmount(id, fundId, subscribedAmount) {
    const query = {
        id,
        fundId,
        subscribedAmount
    }
    return request({
        url: '/investor/fundInvestor/calculation',
        method: 'post',
        params: query
    })
}

// 根据FundId查出当前基金下的所有出资人
export function findInvestByFundId(fundId) {
    return request({
        url: '/investor/fundInvestor/findInvestByFundId/' + fundId,
        method: 'get'
    })
}

// 根据lp_view 视图中的id 获取对应的出资人
export function findLpViewGetInvest(id, fundId) {
    return request({
        url: '/investor/fundInvestor/findLpViewGetInvest/' + id + '/' + fundId,
        method: 'get'
    })
}

// 投资期 基金资金情况 饼状图
export function findFundFunds(fundId) {
    return request({
        url: '/investor/fundInvestor/findFundFunds/' + fundId,
        method: 'get'
    })
}

// 查询出资人收益测算信息列表
export function listIncomeMeasure(query) {
  return request({
    url: '/investor/fundInvestor/incomeMeasure',
    method: 'get',
    params: query
  })
}

// 查询出资人历史IRR列表
export function getFundInvestorIrrHistory(dataId) {
  return request({
    url: '/investor/fundInvestor/getFundInvestorIrrHistory/' + dataId,
    method: 'get'
  })
}

export function findGrAndJgByLpId(lpId) {
  return request({
    url: '/investor/fundInvestor/findGrAndJgByLpId/' + lpId,
    method: 'get'
  })
}
